library(igraph)

# Convert  dataframe to a matrix
X1518.mat <- as.matrix(X15_18_noweights)

X0514.mat<-X0514.mat[,-3]

# Convert  matrix to an igraph object
g <- graph.edgelist(X1518.mat, directed = FALSE)


# Make a very basic plot of the network
plot(g)


# Get the average path length of the graph g
g.apl <- mean_distance(g, directed = FALSE)
g.apl